package app.auto.runner.base.rounter.flow;

import android.content.Context;

import java.util.Map;
import java.util.Set;
import java.util.TreeSet;

import app.auto.runner.base.BroadcastBuilder;
import app.auto.runner.base.intf.MapBuilder;

import static app.auto.runner.base.rounter.flow.FlowCast.PARAMDATA;
//同步容器
public abstract class FlowTask{
    public static Set<FlowTask> registerNames= new TreeSet<FlowTask>(){
        {


        }
    };

    public abstract void proceed();

    private Context paramEnv;

    public FlowTask with(Context context) {
        this.paramEnv = context;
        return this;
    }


    public void end(Map runParams, Object result){
        BroadcastBuilder.build().sendAction(getClass().getName(), paramEnv, MapBuilder.build().addMap(runParams).add(PARAMDATA, result), BroadcastBuilder.Starttype.broadcast);
    }

}
